<h1><%= "Radiant Configuration"[:radiant_configuration] %></h1>

<% form_tag '/admin/configuration' do %>
<% 
	current_section = nil
	@config_items.each do |config|
	 	section = config.key.match(/^([a-z_]*)./)[1]
		display_item = config.key.gsub(section+".", '').gsub('.', ' ')
-%>

		<% if section != current_section %>
			<% unless current_section.nil? %>
			</table>
			<% end %>
			<h3><%= section.titleize %></h3>
			<table class="fieldset" cellpadding="0" cellspacing="0" border="0">
		<% end -%>

    <tr>
      <td class="label" style="width: 250px;"><label for="<%= config.key %>"><%= display_item.titleize[display_item.to_sym] %></label></td>
      <td class="field"><%= text_field_tag "config[#{config.key}]", config.value, :class => 'textbox', :maxlength => 255 %></td>
    </tr>		
<% 
	current_section = section
end 
-%>
	</table>
  <p class="buttons">
		<%= submit_tag 'Save Changes'[:save_changes] %>
  </p>
<% end %>